<template>
  <div>
    <div v-if="result != null">
      <div>
        <h1 v-if="result.hasError">发现错误！错误概率{{result.probability}}%</h1>
        <h1 v-else>没有发现错误！</h1>
      </div>
      <div v-if="result.hasError">
        <el-card>
          <h3>修复方案</h3>
          <d-code-editor
              v-model="result.fix"
              :options="{ language: 'java'}"
              style="height: 400px"
          >
          </d-code-editor>
        </el-card>

      </div>

    </div>
  </div>
</template>

<script lang="ts">
import {defineComponent, type PropType} from "vue"

interface Result {
  hasError: boolean,
  probability: number,
  origin: string,
  fix: string
}

export default defineComponent({
  props: {
    result: {
      type: Object as PropType<Result | null>, // 使用自定义类型
      required: true, // 如果这个 prop 是必须的
    },
  },
});
</script>

<script setup lang="ts">

</script>


<style scoped>

</style>